var severUrl = 'http://admin.mumway.com/index/houseworker/';
// var severUrl = '/index/houseworker/';
var checkPhone = function(phone){
    if(!(/^1[34578]\d{9}$/.test(phone))){
        return false;
    } else{
        return true;

    }
}






var loginObj = {
  LogOut:function() {
    delete window.localStorage.loginInfo;
    window.location.reload();
  },
	setLogoinInfo: function(phone, code) {
		var loginInfo = {
			time: new Date().getTime(),
			phone: phone,
			code: code
		}

		window.localStorage.loginInfo = JSON.stringify(loginInfo);

	},

	getLogoinInfo: function() {
		if (window.localStorage.loginInfo && window.localStorage.loginInfo != '' && window.localStorage.loginInfo != null) {
			var porject = JSON.parse(window.localStorage.loginInfo);
			var time = null;
			if (porject.time && porject.phone) {
				time = new Date().getTime() - porject.time;
				if (!(time > ((7*24*60*60)*1000))) {
					return porject.phone;
				}else{
					delete window.localStorage.loginInfo
					console.log('登陆超时');
					this.toLogin();
				}
			}else{
				console.log('未登陆');
				this.toLogin();
			}

		}else{
			console.log('之前未登陆');
			this.toLogin();
		}

	},
	getLogoinStatus: function() {
		if (window.localStorage.loginInfo && window.localStorage.loginInfo != '' && window.localStorage.loginInfo != null) {
			var porject = JSON.parse(window.localStorage.loginInfo);
			var time = null;
			if (porject.time && porject.phone) {
				time = new Date().getTime() - porject.time;
				if (!(time > ((7*24*60*60)*1000))) {
					return porject;
				}else{
					delete window.localStorage.loginInfo
					console.log('登陆超时');
					return false;
				}
			}else{
				console.log('未登陆');
				return false;

			}

		}else{
			console.log('之前未登陆');
			return false;
		}

	},
	toLogin:function() {
		//登陆
		console.log('登陆')
		window.location.href = 'index.html';
	}

}


function GetQueryString(name){
    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if(r!=null)return  unescape(r[2]); return null;
  }
